import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop024销售管理-发货单"
bianji='小米Mix3 全网通版 8GB+128GB 黑色 磁动力滑盖全面屏'
# 2.回到后台界面，点击“编辑查看”，点击“评价回复”，评价回复“谢谢亲的支持和好评”，点击“回复商品评价”按钮。评价成功。"
firefox=openBrowser(urlAdmin) #调用函数打开指定网址,并且获取函数的返回值,函数返回的是浏览器的对象
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'商品管理','商品评价')
time.sleep(2)
firefox.find_element_by_xpath("//td[text()='%s']/following-sibling::td[4]/a"%bianji).click()
time.sleep(3)
firefox.find_element_by_link_text("评价回复").click()
time.sleep(3)
firefox.find_element_by_id("reply_comment_content").send_keys("评价成功")
firefox.find_element_by_xpath("//button[text()='回复商品评价']").click()
time.sleep(4)
# 删除
firefox.find_element_by_xpath("//td[text()='cyy']/following-sibling::td[5]/a[2]").click()
time.sleep(1)
firefox.switch_to_alert().accept()
time.sleep(6)
str=firefox.find_element_by_xpath("(//div[contains(.,'商品评价')])[6]").text
a="商品评价 - "+"\(评价数："
b="\)"
order=reGetString(str,a,b)
yuji="0"
if yuji==order:
    writeLog("%s 测试通过" % testCase)

else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)

firefox.quit()